package com.herench.bs.handler;

import com.herench.bs.annotation.Handler;
import com.herench.bs.support.AbstractMessageHandler;
import com.herench.bs.support.RequestMessage;
import com.herench.bs.support.ResponseMessage;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by ThinkPad on 2018/3/8.
 */
@Component
@Handler(code = "101100" ,name="医院资讯")
public class HospitalInfoLoaderHandler extends AbstractMessageHandler {

    @Override
    protected ResponseMessage innerHandler(RequestMessage requestMessage) throws Exception {
        ResponseMessage responseMessage = new ResponseMessage(requestMessage.getId());
        String channelCode = requestMessage.getArgsPropertyStringValue("sysCode");
        List<Map<String, Object>> resultList = new ArrayList<>();

        if (channelCode.equals("100101")) {

            Map<String, Object> infoMap = new HashMap<>();
            Map<String, Object> parkMap = new HashMap<>();
            Map<String, Object> healthMap = new HashMap<>();
            resultList.add(infoMap);
            resultList.add(parkMap);
            resultList.add(healthMap);
            List<Map<String, Object>> infoList = new ArrayList<>();
            infoMap.put("name","医院新闻");
            infoMap.put("firstPicure","http://39.106.103.34:9002/bs/image/20180308172454.jpg");
            infoMap.put("contentList",infoList);
            Map<String, Object> subInfoMap1 = new HashMap<>();
            subInfoMap1.put("picture", "http://39.106.103.34:9002/bs/image/20180308172454.jpg");
            subInfoMap1.put("title", "节俭办会 三会合开 注重实效");
            subInfoMap1.put("time", "2017-02-21");
            subInfoMap1.put("href", "http://www.chesthospital.com/system/2015/07/02/011226881.shtml");
            infoList.add(subInfoMap1);
            List<Map<String, Object>> parkList = new ArrayList<>();
            parkMap.put("name","护理园地");
            parkMap.put("firstPicure","http://39.106.103.34:9002/bs/image/20180308172454.jpg");
            parkMap.put("contentList",parkList);
            Map<String, Object> subParkMap1 = new HashMap<>();
            subParkMap1.put("picture", "http://39.106.103.34:9002/bs/image/20180308172454.jpg");
            subParkMap1.put("title", "医院12名护理人员赴台进修");
            subParkMap1.put("time", "2017-02-21");
            subParkMap1.put("href", "http://www.chesthospital.com/system/2015/07/02/011226881.shtml");
            parkList.add(subParkMap1);
            List<Map<String, Object>> healthList = new ArrayList<>();
            healthMap.put("name","健康知识");
            healthMap.put("firstPicure","http://39.106.103.34:9002/bs/image/20180308172454.jpg");
            healthMap.put("contentList",healthList);
            Map<String, Object> subHealthMap1 = new HashMap<>();
            subHealthMap1.put("picture", "http://39.106.103.34:9002/bs/image/20180308172454.jpg");
            subHealthMap1.put("title", "雨水节气的中医养生");
            subHealthMap1.put("time", "2017-02-21");
            subHealthMap1.put("href", "http://www.chesthospital.com/system/2015/07/02/011226881.shtml");
            healthList.add(subHealthMap1);

        }
        responseMessage.setDataAttribute("infoList", resultList);
        responseMessage.setCode("0");
        responseMessage.setMessage("请求成功");
        return responseMessage;
    }
}
